import Layout from '../components/Layout'
/*

hidden:true隐藏路由
alwaysShow:true 当路由下面的children只有一个时将路由提前，不显示当前路由
*/

const routes = [
  {
    path: '/',
    component: Layout,
    meta: {
      title: '默认首页'
    },
    alwaysShow: true,
    redirect: '/home',
    children: [
      {
        path: 'home',
        meta: {
          title: '首页',
          icon: 'cms-shouye fontFamily-26'
        },
        component: () => import('../views')
      },
      {
        path: 'profile',
        meta: {
          title: '个人中心',
          icon: 'el-icon-s-promotion'
        },
        hidden: true,
        component: () => import('../views/users/profile/profile')
      }

    ]
  },
  {
    path: '/system',
    meta: {
      title: '系统管理'
    },
    alwaysShow: true,
    component: Layout,
    redirect: '/Webset',
    children: [
      {
        path: 'Webset',
        meta: {
          title: '系统管理',
          icon: 'cms-Management_system fontFamily-24'
        },
        component: () => import('../views/sys/Webset')
      }
    ]
  },
  {
    path: '/user',
    meta: {
      title: '用户管理'
    },
    alwaysShow: true,
    children: [
      {
        path: 'list',
        meta: {
          title: '用户管理',
          icon: 'cms-yonghu1 fontFamily-24'
        },
        component: () => import('../views/users/index')
      }
    ],
    component: Layout
  },
  {
    path: '/role',
    // component: Layout,
    meta: {
      title: '角色管理'
    },
    alwaysShow: true,
    component: Layout,
    redirect: '/Permission',
    children: [
      {
        path: 'Permission',
        meta: {
          title: '角色管理',
          icon: 'cms-jiaoseguanli fontFamily-24'
        },
        component: () => import('../views/role/Permission')
      }
    ]
  },
  {
    path: '/content',
    meta: {
      title: '文章管理',
      icon: 'cms-navicon-wzgl fontFamily-24'
    },
    component: Layout,
    children: [
      {
        path: 'list',
        meta: {
          title: '文章列表',
          icon: 'cms-wenzhang2 fontFamily-content'
        },
        component: () => import('../views/content/List')
      },
      {
        path: 'classify',
        meta: {
          title: '文章栏目',
          icon: 'cms-wenzhang fontFamily-content'
        },
        component: () => import('../views/content/Classify')
      },
      {
        path: 'add',
        meta: {
          title: '添加文章',
          icon: 'cms-wenzhang1 fontFamily-content'
        },
        component: () => import('../views/content/Add')
      },
      {
        path: ':id',
        hidden: true,
        name: 'editArticle',
        meta: {
          title: '编辑文章'
        },
        component: () => import('../views/content/Add')
      }

    ]
  },
  {
    path: '/about',
    component: Layout,
    meta: {
      title: '关于我们'
    },
    alwaysShow: true,
    children: [
      {
        path: 'about',
        meta: {
          title: '关于我们',
          icon: 'cms-guanyuwomen1 fontFamily-26'
        },
        component: () => import('../views/about')
        // component: () => import('../views/login')
        // component: () => import('../views/register')

      }
    ]

  },

  // 登录
  {
    path: '/login',
    component: () => import('../views/login'),
    hidden: true,
    meta: {
      title: '登录',
      icon: ''
    }
  },

  //   这个路由一定要放在最后，匹配不到上面的路由，就匹配404路由
  {
    path: '*',
    hidden: true, // 隐藏路由
    meta: {
      title: '404错误'
    },
    component: () => import('../views/error/404')
  }

]

export default routes
